int search(int* nums, int numsSize, int target){
    int sizex = ((numsSize-1)/2),sizey = 0,sizez = numsSize-1;
    while(target != nums[sizex]){
        if(nums[sizex] > target){
            sizez = sizex;
            sizex = ((sizey + sizez)/2);
        }else if(nums[sizex] < target){
            sizey = sizex;
            sizex = ((sizey + sizez)/2);
        }else if(nums[sizex] == target){
            break;
        }
        if(sizex == sizey){
            if(nums[sizey] == target){
                break;
            }else if(nums[sizez] == target){
                sizex = sizez;
                break;
            }else{
                return -1;
            }
        }
    }
    return sizex;
}
